
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script>
    <script type="text/javascript" src="http://libs.useso.com/js/respond.js/1.4.2/respond.min.js"></script>
    <script type="text/javascript" src="http://cdn.bootcss.com/css3pie/2.0beta1/PIE_IE678.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="/static/css/H-ui.css"/>
    <link type="text/css" rel="stylesheet" href="/static/css/H-ui.admin.css"/>
    <link type="text/css" rel="stylesheet" href="/static/font/font-awesome.min.css"/>
    <!--[if IE 7]>
    <link href="http://www.bootcss.com/p/font-awesome/assets/css/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    <title>添加用户</title>
</head>
<body>
<div class="pd-20">
    <div class="Huiform">
        {if $error}
          {$error}
        {/if}
        <form action="" method="post" enctype="multipart/form-data">
            <table class="table table-bg">
                <tbody>
                <tr>
                    <th width="100" class="text-r"><span class="c-red">*</span> 分类名称：</th>
                    <td><input type="text" style="width:200px" class="input-text" value="" placeholder="" name="name" datatype="*2-16" nullmsg="用户名不能为空"></td>
                </tr>
                <tr>
                    <th width="100" class="text-r"><span class="c-red">*</span> 顶级分类：</th>
                    <td>
                        <select name="tname">
                            {volist name='type' id='v'}
                                <option value="{$v.tid}">{$v.t_name}</option>
                            {/volist}

                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="text-r"><span class="c-red">*</span>图片：</th>
                    <td><input type="file" name="img"></td>
                </tr>
                <tr>
                    <th class="text-r"><span class="c-red">*</span> 状态：</th>
                    <td><label>
                        <input name="stater" type="radio" value="1" checked>
                        启用</label>
                        <label>
                            <input type="radio" name="stater" value="0">
                            禁用</label></td>
                </tr>
                <tr>
                    <th width="100" class="text-r"><span class="c-red">*</span> 排序：</th>
                    <td><input type="text" name="order"></td>
                </tr>
                <tr>
                    <th class="text-r"><span class="c-red">*</span> 所在地址：</th>
                    <td>
                        <select class="select" name="province_id" id="province_id" style="width: 100px">
                            <option value="0">请选择</option>
                            {volist name='citvs' id='city'}
                            <option value="{$city['id']}">{$city['name']}</option>
                            {/volist}
                        </select>
                        <select class="select" name="city_id" id="city_id"  style="width: 100px">
                            <option value="0">请选择</option>
                        </select>
                        <select class="select" name="area_id" id="area_id"  style="width: 100px">
                            <option value="0">请选择</option>
                        </select>
                    </td>

                </tr>
                <tr>
                    <th></th>
                    <td><button class="btn btn-success radius" type="submit"><i class="icon-ok"></i> 确定</button></td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript" src="http://cdn.bootcss.com/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="/static/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" src="/static/H-ui.js"></script>
<script type="text/javascript" src="/static/H-ui.admin.js"></script>

</body>
</html>
<script>
    $(function () {
        $("#province_id").change(function () {
            $("#city_id").empty().append('<option value="0">请选择</option>');
            $("#area_id").empty().append('<option value="0">请选择</option>');

            let pid=$(this).val();
            $.ajax({
                type:'post',
                url:'/admin/index/getChilc',
                dataType:'json',
                data:{pid:pid},
                success:function (res) {
                    console.log(res)
                    res.forEach(function (v) {
                        console.log(v)
                        $("#city_id").append(`<option value="${v.id}">${v.name}</option>`);
                    })

                }
            })
        })
        $("#city_id").change(function () {
            $("#area_id").empty().append('<option value="0">请选择</option>');
            let pid=$(this).val();
            $.ajax({
                type:'post',
                url:'/admin/index/getChilc',
                dataType:'json',
                data:{pid:pid},
                success:function (res) {
                    console.log(res)
                    res.forEach(function (v) {
                        console.log(v)
                        $("#area_id").append(`<option value="${v.id}">${v.name}</option>`);
                    })

                }
            })
        })
    })
</script>